package com.aigc.sclassroom.controller;

import com.aigc.sclassroom.pojo.Result;
import com.aigc.sclassroom.utils.chatWenXin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/doChat")
public class ChatController {

    @PostMapping("/WenXin")
    public Result<String> doWenXin(@RequestBody String content) throws IOException, InterruptedException {
        try {
            return new Result(0,"操作成功",chatWenXin.doChat(content));
        }catch (Exception e){
            System.out.println(e);
            return new Result(1,"操作失败",e);
        }
    }


}
